//
//  ViewController.m
//  lessthree
//
//  Created by liuchengming on 16/4/20.
//  Copyright © 2016年 liuchengming. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()<UITableViewDataSource>
{
    NSArray * data;
}

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    data = @[@"🐷头",
             @"🐂头",
             @"🐶头",
             @"脑子有坑吗？"];
    
    
    UITableView * tableview = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
    
    
    tableview.dataSource = self;
    
    
    [self.view addSubview:tableview ];
    
    NSLog(@"视图已经加载");
    
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return data.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell * cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle  reuseIdentifier:nil];
    
    cell.textLabel.text = data [indexPath.row];
    cell.detailTextLabel.text = @"depasfhugi";
    return cell;
}




-(void)viewWillAppear:(BOOL)animated
{
    NSLog(@"视图将要显示");
}


-(void)viewDidAppear:(BOOL)animated
{
    NSLog(@"视图已经显示");
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
